﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JavaDevToys.Rcl.Global.Nav.Model
{
    public class NavItem
    {
        public string Name { get; set; }

        public string? Url { get; set; }

        public string? Icon { get; set; }

        public List<NavItem>? Children { get; set; }

        public List<string>? Group => Children?.Select(x => x.Url)?.ToList();

        public bool Exact { get; set; }

        public string? MatchPattern { get; set; }

        public NavItem(string name, string url)
        {
            Name = name;
            Url = url;
        }

        public NavItem(string name, string url, bool exact) : this(name, url)
        {
            Exact = exact;
        }

        public NavItem(string name, string url, string matchPattern) : this(name, url)
        {
            MatchPattern = matchPattern;
        }

        public NavItem(string name, string icon, List<NavItem> children)
        {
            Name = name;
            Icon = icon;
            Children = children;
        }
    }
}
